package com.carlinfo.userscenter.users.pojo;

import java.util.Date;

/**
 * ~POJO(Plain Object java Object:(JavaBean)
 * 	得一个属性
 * 	得提供读写器
 * 	得有一个无参的构造函数
 * 
 * ~类名和表名一样
 * ~属性名和列名一样
 * ~对象和表里面的记录一样
 * ~表中间的下划线去掉
 * 
 * ~列模式:alt + shift + a;
 * ~属性:四类八种默认值是0,包装类型默认是null;
 * @author wangshMac
 */
public class AAdmins
{
	private int id;
	private int roleId;
	private String email;
	private String password;
	private String photoPath;
	private String trueName;
	private String phone;
	private String qq;
	private byte sex ; 
	private int loginFailedCount;
	private Date loginFailedTime;
	private int loginCount;
	private String lastLoginIp;
	private byte status;
	private Date createTime;
	private Date updateTime;
	private Date pubTime;
	private Date lastloginTime;

	/* 关联对象
	 * 朝代和皇上
	 *  */
	private ARole role ; 
	
	/* 字符串描述
	 * 只提供get方法
	 *  */
	private String statusStr ; 
	private String sexStr ; 
	
	/*
	 * 读写器(set/get)生成的快捷键是:alt+shift+s
	 * */
	public int getId()
	{
		return id;
	}

	public void setId(int id)
	{
		this.id = id;
	}

	public int getRoleId()
	{
		return roleId;
	}

	public void setRoleId(int roleId)
	{
		this.roleId = roleId;
	}

	public String getEmail()
	{
		return email;
	}

	public void setEmail(String email)
	{
		this.email = email;
	}

	public String getPassword()
	{
		return password;
	}

	public void setPassword(String password)
	{
		this.password = password;
	}

	public String getPhotoPath()
	{
		return photoPath;
	}

	public void setPhotoPath(String photoPath)
	{
		this.photoPath = photoPath;
	}

	public String getTrueName()
	{
		return trueName;
	}

	public void setTrueName(String trueName)
	{
		this.trueName = trueName;
	}

	public String getPhone()
	{
		return phone;
	}

	public void setPhone(String phone)
	{
		this.phone = phone;
	}

	public String getQq()
	{
		return qq;
	}

	public void setQq(String qq)
	{
		this.qq = qq;
	}

	public int getLoginFailedCount()
	{
		return loginFailedCount;
	}

	public void setLoginFailedCount(int loginFailedCount)
	{
		this.loginFailedCount = loginFailedCount;
	}

	public Date getLoginFailedTime()
	{
		return loginFailedTime;
	}

	public void setLoginFailedTime(Date loginFailedTime)
	{
		this.loginFailedTime = loginFailedTime;
	}

	public int getLoginCount()
	{
		return loginCount;
	}

	public void setLoginCount(int loginCount)
	{
		this.loginCount = loginCount;
	}

	public String getLastLoginIp()
	{
		return lastLoginIp;
	}

	public void setLastLoginIp(String lastLoginIp)
	{
		this.lastLoginIp = lastLoginIp;
	}

	public byte getStatus()
	{
		return status;
	}

	public void setStatus(byte status)
	{
		this.status = status;
	}

	public Date getCreateTime()
	{
		return createTime;
	}

	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}

	public Date getUpdateTime()
	{
		return updateTime;
	}

	public void setUpdateTime(Date updateTime)
	{
		this.updateTime = updateTime;
	}

	public Date getPubTime()
	{
		return pubTime;
	}

	public void setPubTime(Date pubTime)
	{
		this.pubTime = pubTime;
	}

	public Date getLastloginTime()
	{
		return lastloginTime;
	}

	public void setLastloginTime(Date lastloginTime)
	{
		this.lastloginTime = lastloginTime;
	}

	@Override
	public String toString()
	{
		return "AAdmins [id=" + id + ", roleId=" + roleId + ", email=" + email + ", password=" + password
				+ ", photoPath=" + photoPath + ", trueName=" + trueName + ", phone=" + phone + ", qq=" + qq
				+ ", loginFailedCount=" + loginFailedCount + ", loginFailedTime=" + loginFailedTime + ", loginCount="
				+ loginCount + ", lastLoginIp=" + lastLoginIp + ", status=" + status + ", createTime=" + createTime
				+ ", updateTime=" + updateTime + ", pubTime=" + pubTime + ", lastloginTime=" + lastloginTime + "]";
	}

	public ARole getRole()
	{
		return role;
	}

	public void setRole(ARole role)
	{
		this.role = role;
	}

	public String getStatusStr_Source()
	{
		/*状态:0:禁用,1:启用*/
		if(this.status == 0 )
		{
			this.statusStr = "禁用" ; 
		}else if(this.status == 1)
		{
			this.statusStr = "启用" ; 
		}
		return statusStr;
	}
	
	public String getStatusStr()
	{
		AAdminsEnum[] values = AAdminsEnum.values() ; 
		for (int i = 0; i < values.length; i++)
		{
			AAdminsEnum adminsEnumTemp = values[i];
			/* 
			 * toString:变量名
			 * name:枚举的键,
			 * getstatus:枚举的值
			 * */
			if(adminsEnumTemp.toString().startsWith("STATUS"))
			{
				if(adminsEnumTemp.getStatus() == this.status)
				{
					this.statusStr = adminsEnumTemp.getName(); 
				}
			}
			//System.out.println(adminsEnumTemp.getName() + "=====>" + adminsEnumTemp.getStatus() + "--->" + adminsEnumTemp);
		}
		return statusStr;
	}

	public byte getSex()
	{
		return sex;
	}

	public void setSex(byte sex)
	{
		this.sex = sex;
	}

	public String getSexStr()
	{
		AAdminsEnum[] values = AAdminsEnum.values() ; 
		for (int i = 0; i < values.length; i++)
		{
			AAdminsEnum adminsEnumTemp = values[i];
			/* 
			 * toString:变量名
			 * name:枚举的键,
			 * getstatus:枚举的值
			 * */
			if(adminsEnumTemp.toString().startsWith("SEX"))
			{
				if(adminsEnumTemp.getStatus() == this.sex)
				{
					this.sexStr = adminsEnumTemp.getName(); 
				}
			}
			//System.out.println(adminsEnumTemp.getName() + "=====>" + adminsEnumTemp.getStatus() + "--->" + adminsEnumTemp);
		}
		return sexStr;
	}

}
